#pragma once

#include<iostream>
#include<vector>
#include<ctime>

typedef void (*func)();

void PrintLog()
{
    std::cout << "我是一个打印日志的任务" << std::endl;
}

void Download()
{
    std::cout << "我是一个下载的任务" << std::endl;
}

void Upload()
{
    std::cout << "我是一个上传的任务" << std::endl;
}

class TaskManager
{
public:
    TaskManager()
    {
        srand(time(0));
        _task.emplace_back(PrintLog);
        _task.emplace_back(Download);
        _task.emplace_back(Upload);
    }
    int SelecTask()
    {
        return rand() % _task.size();
    }
    void Execute(int code)
    {
        _task[code]();
    }
private:
    std::vector<func> _task;
};